{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "converting s3dis_semseg-pt-v2m2-2-one-cycle_best.pth\n",
      "replace backbone.dec_stages.0.up.proj.0.weight with backbone.dec_stages.2.up.proj.0.weight\n",
      "replace backbone.dec_stages.0.up.proj.0.bias with backbone.dec_stages.2.up.proj.0.bias\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.weight with backbone.dec_stages.2.up.proj.1.norm.weight\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.bias with backbone.dec_stages.2.up.proj.1.norm.bias\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.running_mean with backbone.dec_stages.2.up.proj.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.running_var with backbone.dec_stages.2.up.proj.1.norm.running_var\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.num_batches_tracked with backbone.dec_stages.2.up.proj.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.up.proj_skip.0.weight with backbone.dec_stages.2.up.proj_skip.0.weight\n",
      "replace backbone.dec_stages.0.up.proj_skip.0.bias with backbone.dec_stages.2.up.proj_skip.0.bias\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.weight with backbone.dec_stages.2.up.proj_skip.1.norm.weight\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.bias with backbone.dec_stages.2.up.proj_skip.1.norm.bias\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.running_mean with backbone.dec_stages.2.up.proj_skip.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.running_var with backbone.dec_stages.2.up.proj_skip.1.norm.running_var\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.num_batches_tracked with backbone.dec_stages.2.up.proj_skip.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.fc1.weight with backbone.dec_stages.2.blocks.blocks.0.fc1.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.fc3.weight with backbone.dec_stages.2.blocks.blocks.0.fc3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.up.proj.0.weight with backbone.dec_stages.0.up.proj.0.weight\n",
      "replace backbone.dec_stages.2.up.proj.0.bias with backbone.dec_stages.0.up.proj.0.bias\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.weight with backbone.dec_stages.0.up.proj.1.norm.weight\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.bias with backbone.dec_stages.0.up.proj.1.norm.bias\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.running_mean with backbone.dec_stages.0.up.proj.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.running_var with backbone.dec_stages.0.up.proj.1.norm.running_var\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.num_batches_tracked with backbone.dec_stages.0.up.proj.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.up.proj_skip.0.weight with backbone.dec_stages.0.up.proj_skip.0.weight\n",
      "replace backbone.dec_stages.2.up.proj_skip.0.bias with backbone.dec_stages.0.up.proj_skip.0.bias\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.weight with backbone.dec_stages.0.up.proj_skip.1.norm.weight\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.bias with backbone.dec_stages.0.up.proj_skip.1.norm.bias\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.running_mean with backbone.dec_stages.0.up.proj_skip.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.running_var with backbone.dec_stages.0.up.proj_skip.1.norm.running_var\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.num_batches_tracked with backbone.dec_stages.0.up.proj_skip.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.fc1.weight with backbone.dec_stages.0.blocks.blocks.0.fc1.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.fc3.weight with backbone.dec_stages.0.blocks.blocks.0.fc3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.num_batches_tracked\n",
      "converting s3dis_semseg-pt-v2m2-2-one-cycle_last.pth\n",
      "replace backbone.dec_stages.0.up.proj.0.weight with backbone.dec_stages.2.up.proj.0.weight\n",
      "replace backbone.dec_stages.0.up.proj.0.bias with backbone.dec_stages.2.up.proj.0.bias\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.weight with backbone.dec_stages.2.up.proj.1.norm.weight\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.bias with backbone.dec_stages.2.up.proj.1.norm.bias\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.running_mean with backbone.dec_stages.2.up.proj.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.running_var with backbone.dec_stages.2.up.proj.1.norm.running_var\n",
      "replace backbone.dec_stages.0.up.proj.1.norm.num_batches_tracked with backbone.dec_stages.2.up.proj.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.up.proj_skip.0.weight with backbone.dec_stages.2.up.proj_skip.0.weight\n",
      "replace backbone.dec_stages.0.up.proj_skip.0.bias with backbone.dec_stages.2.up.proj_skip.0.bias\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.weight with backbone.dec_stages.2.up.proj_skip.1.norm.weight\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.bias with backbone.dec_stages.2.up.proj_skip.1.norm.bias\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.running_mean with backbone.dec_stages.2.up.proj_skip.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.running_var with backbone.dec_stages.2.up.proj_skip.1.norm.running_var\n",
      "replace backbone.dec_stages.0.up.proj_skip.1.norm.num_batches_tracked with backbone.dec_stages.2.up.proj_skip.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.weight with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.bias with backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.weight with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.bias with backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.fc1.weight with backbone.dec_stages.2.blocks.blocks.0.fc1.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.fc3.weight with backbone.dec_stages.2.blocks.blocks.0.fc3.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm1.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm2.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm2.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.weight with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.weight\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.bias with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.bias\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_mean with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_mean\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_var with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_var\n",
      "replace backbone.dec_stages.0.blocks.blocks.0.norm3.norm.num_batches_tracked with backbone.dec_stages.2.blocks.blocks.0.norm3.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.up.proj.0.weight with backbone.dec_stages.0.up.proj.0.weight\n",
      "replace backbone.dec_stages.2.up.proj.0.bias with backbone.dec_stages.0.up.proj.0.bias\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.weight with backbone.dec_stages.0.up.proj.1.norm.weight\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.bias with backbone.dec_stages.0.up.proj.1.norm.bias\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.running_mean with backbone.dec_stages.0.up.proj.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.running_var with backbone.dec_stages.0.up.proj.1.norm.running_var\n",
      "replace backbone.dec_stages.2.up.proj.1.norm.num_batches_tracked with backbone.dec_stages.0.up.proj.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.up.proj_skip.0.weight with backbone.dec_stages.0.up.proj_skip.0.weight\n",
      "replace backbone.dec_stages.2.up.proj_skip.0.bias with backbone.dec_stages.0.up.proj_skip.0.bias\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.weight with backbone.dec_stages.0.up.proj_skip.1.norm.weight\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.bias with backbone.dec_stages.0.up.proj_skip.1.norm.bias\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.running_mean with backbone.dec_stages.0.up.proj_skip.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.running_var with backbone.dec_stages.0.up.proj_skip.1.norm.running_var\n",
      "replace backbone.dec_stages.2.up.proj_skip.1.norm.num_batches_tracked with backbone.dec_stages.0.up.proj_skip.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_q.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_k.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_v.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_v.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.weight with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.linear_p_bias.3.bias with backbone.dec_stages.0.blocks.blocks.0.attn.linear_p_bias.3.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.0.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.0.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.weight with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.attn.weight_encoding.3.bias with backbone.dec_stages.0.blocks.blocks.0.attn.weight_encoding.3.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.fc1.weight with backbone.dec_stages.0.blocks.blocks.0.fc1.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.fc3.weight with backbone.dec_stages.0.blocks.blocks.0.fc3.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm1.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm1.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm2.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm2.norm.num_batches_tracked\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.weight with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.weight\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.bias with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.bias\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_mean with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_mean\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.running_var with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.running_var\n",
      "replace backbone.dec_stages.2.blocks.blocks.0.norm3.norm.num_batches_tracked with backbone.dec_stages.0.blocks.blocks.0.norm3.norm.num_batches_tracked\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "import os\n",
    "\n",
    "replace = {\n",
    "    \"backbone.dec_stages.0\": \"backbone.dec_stages.2\",\n",
    "    \"backbone.dec_stages.2\": \"backbone.dec_stages.0\"\n",
    "}\n",
    "replace_keys = set(replace.keys())\n",
    "pretrianed_dir = \"pretrained\"\n",
    "\n",
    "files = os.listdir(pretrianed_dir)\n",
    "for f in files:\n",
    "    if f.endswith(\".pth\"):\n",
    "        print(f\"converting {f}\")\n",
    "        ckpt = torch.load(f\"{pretrianed_dir}/{f}\")\n",
    "        states = ckpt[\"state_dict\"]\n",
    "        new_states = {}\n",
    "        for k in list(states.keys()):\n",
    "            fit_prefix = None\n",
    "            for r in replace.keys():\n",
    "                if k.startswith(r):\n",
    "                    fit_prefix = r\n",
    "                    new_prefix = replace[r]\n",
    "                    break\n",
    "            if fit_prefix is not None:\n",
    "                new_k = new_prefix + k[len(fit_prefix):]\n",
    "                new_states[new_k] = states[k]\n",
    "                print(f\"replace {k} with {new_k}\")\n",
    "            else:\n",
    "                new_states[k] = states[k]\n",
    "        ckpt[\"state_dict\"] = new_states\n",
    "        torch.save(ckpt, f\"{pretrianed_dir}/converted_{f}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pointcept",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
